<%- include('./layouts/admin_header1.ejs') %>

<title>Posts &laquo; Admin</title>
<%- include('./layouts/admin_header2.ejs') %>

<%- include('./layouts/admin_navbar.ejs') %>

 <div class="container-fluid">
    <div class="page-title">
      <h1>所有文章</h1>
      <a href="/admin/post-add" class="btn btn-primary btn-xs">写文章</a>
    </div>
    <!-- 有错误信息时展示 -->
    <div class="alert alert-danger" style="display:none ">
        <strong>错误！</strong> <span>发生XXX错误</span>
      </div>
    <div class="page-action">
      <!-- show when multiple checked -->
      <a class="btn btn-danger btn-sm" href="javascript:;" style="display: none">批量删除</a>
      <form class="form-inline">
        <select name="" class="form-control input-sm cateSelector">
          
        </select>
        <select name="" class="form-control input-sm statuSelector">
          <option value="all">所有状态</option>
          <option value="drafted">草稿</option>
          <option value="published">已发布</option>
        </select>
        <input type='button' class="btn btn-default btn-sm btn-search" value="筛选">
      </form>
      <ul class="pagination pagination-sm pull-right" style="float: right">
        <li><a href="#">上一页</a></li>
        <li><a href="#">1</a></li>
        <li><a href="#">2</a></li>
        <li><a href="#">3</a></li>
        <li><a href="#">下一页</a></li>
      </ul>
      </ul>
    </div>
    <table class="table table-striped table-bordered table-hover">
      <thead>
        <tr>
          <th class="text-center" width="40"><input type="checkbox"></th>
          <th>标题</th>
          <th>作者</th>
          <th>分类</th>
          <th class="text-center">发表时间</th>
          <th class="text-center">状态</th>
          <th class="text-center" width="100">操作</th>
        </tr>
      </thead>
      <tbody>

      </tbody>
    </table>
  </div>
</div>

<%- include('./layouts/admin_aside.ejs') %>
<%- include('./layouts/admin_footer.ejs') %>
<script type='text/template' id='postsTemp'>
  {{each data  value}}
  <tr>
      <td class="text-center"><input type="checkbox"></td>
      <td>{{value.title}}</td>
      <td>{{value.nickname}}</td>
      <td>{{value.name}}</td>
      <td class="text-center">{{value.created}}</td>
      <td class="text-center">{{value.status=='published'?'已发布':'草稿'}}</td>
      <td class="text-center">
      <a href="/admin/post-add?id={{value.id}}" class="btn btn-default btn-xs">编辑</a>
      <a href="javascript:;" class="btn btn-danger btn-xs btnDel" data-id={{value.id}}>删除</a>
      </td>
  </tr>
  {{/each}}
</script>
<script src='/assets/vendors/bootstrappaginator/bootstrap-paginator.min.js'></script>
<script src="/assets/vendors/template/template.js"></script>
<script src='/assets/js/posts.js'></script>